from mongoengine import connect

connect(db='test')
connect('test')
connect('test-temp',alias='db2')

connect(
    db='test',          # 数据库名
    host='localhost',      # 主机地址
    port=27017             # 端口号
)

connect(
    db='test',
    # host='mongodb://username:password@localhost:27017/test_db'
    host='mongodb://localhost:27017/test'
)